package cn.dengta.webapp.im.entity;

import java.math.BigDecimal;
import java.util.Date;

import cn.dengta.webapp.base.entity.TimeBasedEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 红包发送记录表
 *
 * @author Ready
 * @since 2022-07-05
 */
@Setter
@Getter
@Accessors(chain = true)
public class RedPacketLog extends TimeBasedEntity {

	private static final long serialVersionUID = 1L;

	/** 领取红包的用户ID */
	Long userId;
	/** 所在群ID */
	Long groupId;
	/** 被领取的红包ID */
	Long redPacketId;
	/** 领取到的钻石数量 */
	Integer coin;
	/** 领取到的钻石数量 */
	Integer coinFreePart;
	/** 领取到钻石转换后的积分数 */
	BigDecimal integral;

	transient RedPacket redPacket;

	public RedPacketLog init(Long userId, Long groupId, Long redPacketId, Integer coin, Integer coinFreePart, BigDecimal integral, Date now) {
		this.userId = userId;
		this.groupId = groupId;
		this.redPacketId = redPacketId;
		this.coin = coin;
		this.coinFreePart = coinFreePart;
		this.integral = integral;
		this.initTime(now);
		return this;
	}

	public static final String USER_ID = "user_id";
	public static final String GROUP_ID = "group_id";
	public static final String RED_PACKET_ID = "red_packet_id";
	public static final String COIN = "coin";

}
